package com.example.httpprocessor;

import android.app.Application;

import com.example.httpprocessor.annotation.BindOkhttp;
import com.example.httpprocessor.annotation.BindVolley;
import com.example.httpprocessor.annotation.BindXUtils;
import com.example.httpprocessor.http.HttpHelper;
import com.example.httpprocessor.http.IHttpProcessor;
import com.example.httpprocessor.http.OKHttpProcessor;
import com.example.httpprocessor.http.VolleyProcessor;
import com.example.httpprocessor.http.XUtilsProcessor;

import javax.inject.Inject;

import dagger.hilt.android.HiltAndroidApp;

@HiltAndroidApp
public class MyApplication extends Application {


    @BindOkhttp
    @Inject
    IHttpProcessor iHttpProcessor;

//    @BindVolley
//    @Inject
//    IHttpProcessor iHttpProcessor;
//   @BindXUtils
//    @Inject
//    IHttpProcessor iHttpProcessor;

    public IHttpProcessor getiHttpProcessor() {
        return iHttpProcessor;
    }

    //  使用  Hilt  注入框架的话下面那些就不用写了
//    @Override
//    public void onCreate() {
//        super.onCreate();
        // 初始化
//        HttpHelper.init(new OKHttpProcessor());
//        HttpHelper.init(new VolleyProcessor(this));
//        HttpHelper.init(new XUtilsProcessor(this));
//    }
}
